apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
  name: grpc
spec:
  gatewayClassName: cilium
  listeners:
    - protocol: HTTP
      port: 80
      name: web-gw
      allowedRoutes:
        namespaces:
          from: Same
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: GRPCRoute
metadata:
  name: yages
spec:
  parentRefs:
    - namespace: default
      name: grpc
  hostnames:
    - my-grpc-service.foo.com
  rules:
    - matches:
        - method:
            service: yages.Echo
            method: Ping
        - method:
            service: grpc.reflection.v1alpha.ServerReflection
            method: ServerReflectionInfo
      backendRefs:
        - name: grpc-echo
          port: 9000
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: grpc-echo
  name: grpc-echo
spec:
  replicas: 2
  selector:
    matchLabels:
      app.kubernetes.io/name: grpc-echo
  template:
    metadata:
      labels:
        app.kubernetes.io/name: grpc-echo
    spec:
      containers:
        - name: grpc-echo
          image: ghcr.io/projectcontour/yages:v0.1.0
          ports:
            - name: grpc
              containerPort: 9000
          readinessProbe:
            exec:
              command: ["/grpc-health-probe", "-addr=localhost:9000"]
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app.kubernetes.io/name: grpc-echo
  name: grpc-echo
spec:
  selector:
    app.kubernetes.io/name: grpc-echo
  ports:
    - port: 9000
      protocol: TCP
      targetPort: grpc
